package tool.plot

import java.io.File
import shared.Pojo._
import tool.Pojo._
import tool.Tool
import implicits.Implicits._
import play.api.data.FormBinding
import play.api.mvc._

/** Created by yz on 11/9/2020
  */
object AllPlot {

  val rPlots = List(
    GroupBar,
    SampleBar,
    ClassCountPie,
    StatPie,
    RfPlot,
    SvmPlot,
    BorutaBox,
    CorNetwork,
    CcaRda,
    RocCv,
    RocCvEach,
    Lda,
    Cladogram,
    Features
  )

  val myRPlots = List(
    VolcanoPlot,
    BoxPlot,
    ViolinPlot,
    StampPlot,
    HorizontalBoxPlot,
    CorHeatmapPlot,
    Pca2D,
    Pca3D,
    Variance,
    PcaBoxplot,
    Plsda2D,
    Plsda3D,
    PlsdaBoxplot,
    Oplsda2D,
    ModelArg,
    PermuteResult,
    VPlot,
    ZScore,
    FsVenn,
    Venn,
    EnrichBar,
    PathwayBar,
    Roc,
    Pr,
    ZScoreHeatmap,
    PathwayBubble,
    EnrichNetwork,
    Heatmap
  )

  trait RPlotB extends RPlot {

    def producePlotConfigFile(data: AllPlotData, workspaceDir: File, extraData: ExtraDataData): Any

    def getCommand(data: AllPlotData, extraData: ExtraDataData): String

    def defaultPlotArg(tmpPlotData: AllPlotData): AllPlotData

  }

  trait MyRPlotB extends MyRPlot {

    def producePlotConfigFile(workspaceDir: File)(implicit
        request: Request[AnyContent],
        formBinding: FormBinding
    ): Any

    def getWorkspaceDir(workspaceDir: File, idStr: String, prefix: String): File = workspaceDir

    def getCommand(implicit configJson: ujson.Value, workspaceDir: File): String

    def shFileName(implicit
        request: Request[AnyContent],
        formBinding: FormBinding
    ): String = {
      s"${name}_plot.sh"
    }

  }

}
